import {config} from './base.js'; //导入接口的前缀地址

export const Request = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: config.baseURL + options.url,
			method: options.method || 'GET',
			data: options.data || {},
			header: options.header || {
				'content-type': 'application/json',
					// TODO: 根据实际情况修改，比如加入token
			},
			success: (res) => {
				if (res.statusCode == 200) {
					resolve(res.data)
					
				} else{
					reject(res.data)
				}
				
				
			},
			fail: (err) => {
				reject(err)
				
			},
			
	
}